package cn.shanke.torrentmanagerserver;

import cn.shanke.torrentmanagerserver.config.AppConfig;
import cn.shanke.torrentmanagerserver.util.ApplicationContextUtil;
import cn.shanke.torrentmanagerserver.util.FileUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;

import java.io.IOException;
import java.util.List;

@SpringBootApplication
@EnableCaching
public class TorrentManagerServerApplication {

	public static void main(String[] args) {
		SpringApplication.run(TorrentManagerServerApplication.class, args);
		// print banner
		List<String> banner =  FileUtil.readAllLines(Thread.currentThread().getContextClassLoader().getResourceAsStream("mybanner.txt"));
		banner.stream().forEach(line -> System.out.println(line));
		System.out.println(String.format(":: Torrent Manager :: (v%s) ", ApplicationContextUtil.getBean(AppConfig.class).getVersion()));
	}
}
